home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Sample Code / Catalog Service Access Module / DTS Sample CSAM / Src / RemoveCatalog.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-24  |  1.3 KB  |  50 lines  |  [TEXT/KAHL]

  1. /*                                    RemoveCatalog.c                                */
  2. /*
  3.  * RemoveCatalog.c
  4.  * Copyright © 1992-93 Apple Computer Inc. All Rights Reserved.
  5.  */
  6. #include "DTSSampleCSAM.h"
  7.  
  8. OSErr
  9. RemoveCatalog(
  10.         register DTSSampleCSAMInfoPtr    infoPtr,
  11.         DirParamBlockPtr                pb
  12.     )
  13. {
  14.         OSErr                        status;
  15.         register CatalogInfoPtr        catalogInfoPtr;
  16. #define CAT    (*catalogInfoPtr)
  17.  
  18.         catalogInfoPtr = (CatalogInfoPtr) INFO.catalogQHdr.qHead;
  19.         while (catalogInfoPtr != NULL) {
  20.             /*
  21.              * Do we need to check for an identical catalog
  22.              * discriminator, too?
  23.              */
  24.             if (OCEEqualCreationID(
  25.                         &pb->removeDirectoryPB.directoryRecordCID,
  26.                         &CAT.creationID)
  27.                     ) {
  28.                 /*
  29.                  * Do we need to remove the contents of the catalog
  30.                  * (such as allocated RStrings, for example)?
  31.                  */
  32.                 status = Dequeue((QElemPtr) catalogInfoPtr, &INFO.catalogQHdr);
  33.                 /*
  34.                  * Now that the catalog has been deleted, should we free up the
  35.                  * memory it has allocated? If so, remember that this routine must
  36.                  * not be called from an I/O completion or an interrupt routine.
  37.                  */
  38.                 goto exit;
  39.             }
  40.             catalogInfoPtr = (CatalogInfoPtr) CAT.qLink;
  41.         }
  42.         /*
  43.          * Fell off the end of the list: this "can't" happen.
  44.          */
  45.         status = qErr;                    /* Element not found    */
  46. exit:    ;
  47.         LogStatus('RemD', status, "\pRemoveCatalog exit");
  48.         return (status);
  49. }
  50.